package gof.com.yew.prototype;

/**
 * 浅拷贝
 * @author yw
 */

public class PrototypeDemo01 {
	
	public static void main(String[] args) throws Exception {
		Address address = new Address("中国", "湖北"); 
		Sheep sheep = new Sheep("多利", address);
		Sheep sheep1 = (Sheep)sheep.Clone();
		System.out.println(sheep.getName());
		System.out.println(sheep.getAddress().getCuntry());
		System.out.println(sheep.getAddress().getLoc());
		System.out.println("-------------------------------------------------");
		System.out.println(sheep1.getName());
		System.out.println(sheep1.getAddress().getCuntry());
		System.out.println(sheep1.getAddress().getLoc());
		System.out.println("-------------------------------------------------");
		address.setLoc("浙江");
		System.out.println(sheep.getAddress().getLoc());
		System.out.println(sheep1.getAddress().getLoc());
	}

}
